<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 * Description of terms_model
 * 
 * @author Subha Sundar Das (subhasundar.das@gmail.com)
 */
class Terms_model extends CI_Model {

    //put your code here

    function __construct() {
        parent::__construct();
        log_message('debug', 'Model Initialized');
    }
//--Get Term results -- Subha (28/08/2012) ---    //
    function get_terms($term='', $listing_id) {
        if ($listing_id)
            $sql = "select * from terms where listing_id = $listing_id and term='$term'";
        else
            $sql = "select * from terms where term='$term' and status=1";
        $query = $this->db->query($sql);
        return $query->result();
    }
//--Get Term (Single Record) --//
    function get_term($id=NULL) {
        $sql = "select * from terms where id = $id limit 1";
        $query = $this->db->query($sql);
        return $query->row();
    }
    //--Delete Term (Single Record) --//
    function delete_term_by_id($id=NULL) {
        $sql = "delete from terms where id = $id ";
        $query = $this->db->query($sql);
    }
}
?>